<template>
    <div>
        <van-nav-bar :title="$route.query.name" left-text="返回" left-arrow @click-left="$router.back()">
            <template #right>
                <van-icon name="search" size="18" />
            </template>
        </van-nav-bar>
        <van-search v-model="searchValue" placeholder="请输入搜索关键词" />
        <div class="content">
            <div class="cards">
                <div class="card" v-for="item in seriesItems" :key="item.name">
                    <div class="item-name">{{ item.name }}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { http } from '../utils/request'
import { useRoute, useRouter } from 'vue-router'
const route = useRoute()
const router = useRouter()
const searchValue = ref('')

// 系列数据
const seriesItems = ref([])

const getInfo = () => {
    http.get(`/category/getSecondLevelCategory?parentId=${route.query.id}`).then(res => {
        seriesItems.value = res
    })
}

onMounted(() => {
    getInfo()
})
</script>

<style scoped>
.content {
    padding: 16px;
}

.title {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: bold;
    color: #323233;
}

.item-card {
    width: 100%;
    padding: 8px;
}

.item-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
}

.item-info {
    padding: 8px 0;
}

.item-name {
    font-size: 14px;
    color: #323233;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-price {
    font-size: 16px;
    color: #f44;
    font-weight: bold;
    margin-top: 4px;
}

/* From Uiverse.io by JaydipPrajapati1910 */
.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}
.card {
    width: calc(50% - 10px);
    height: 250px;
    border: none;
    border-radius: 10px;
    background: radial-gradient(ellipse farthest-side at 76% 77%, rgba(245, 228, 212, 0.25) 4%, rgba(255, 255, 255, 0) calc(4% + 1px)), radial-gradient(circle at 76% 40%, #fef6ec 4%, rgba(255, 255, 255, 0) 4.18%), linear-gradient(135deg, #ff0000 0%, #000036 100%), radial-gradient(ellipse at 28% 0%, #ffcfac 0%, rgba(98, 149, 144, 0.5) 100%), linear-gradient(180deg, #cd6e8a 0%, #f5eab0 69%, #d6c8a2 70%, #a2758d 100%);
    background-blend-mode: normal, normal, screen, overlay, normal;
}
</style>